<?php

/**
 * @name: HOTN AnimeList
 * @author: HammerOnTheNail
 * @link: http://code.google.com/p/hotnanimelist/
 */

// Projectek
$sql->db_Select("hotn_animelist_project", "project_id, project_name, project_mode, project_type", "(`project_mode` = 'active' or `project_mode` = 'finished') and `project_type` = 'manga' ORDER BY project_name ASC");
while ($row = $sql->db_Fetch())
{
	if ($row['project_type'] == "manga") $row['project_type'] = HOTN_ANIMELIST_DEFAULT_MANGA;
	
	if ($row['project_mode'] == "finished")
	{
		$project_finished[$row['project_id']] = $row['project_name']." (".$row['project_type'].")";
	}
	if ($row['project_mode'] == "active")
	{
		$project_active[$row['project_id']] = $row['project_name']." (".$row['project_type'].")";
	}
}

$project = array(
	HOTN_ANIMELIST_ANIMETYPE_ACTIVE => $project_active,
	HOTN_ANIMELIST_ANIMETYPE_FINISHED => $project_finished
); 

$data = array(
		"type" => "form",
		"method" => "post",
		"action" =>  $values['action'],
		"hidden" => $values['hidden'],
		"data" => array(
					array(
						"type" => "select",
						"name" => "project_id",
						"group" => "true",
						"selected" => $values['project_id'],
						"show" => $values['project_id_show'],
						"value" => $project,
						"text" => HOTN_ANIMELIST_ADMIN_FILE_PROJECT_NAME
					),
					array(
						"type" => "text",
						"name" => "download_name",
						"text" => HOTN_ANIMELIST_ADMIN_FILE_DOWNLOAD_NAME,
						"max" => "200",
						"value" => $values['download_name']
					),
					array(
						"type" => "text",
						"name" => "download_episode",
						"text" => HOTN_ANIMELIST_ADMIN_FILE_DOWNLOAD_EPISODE,
						"max" => "10",
						"show" => $values['download_episode_show'],
						"value" => $values['download_episode']
					),
					array(
						"type" => "select",
						"name" => "download_url",
						"text" => HOTN_ANIMELIST_ADMIN_FILE_DOWNLOAD_URL,
						"show" => $values['download_url_show'],
						"value" => $download_files
					),
					array(
						"type" => "select",
						"name" => "download_type",
						"text" => HOTN_ANIMELIST_ADMIN_FILE_DOWNLOAD_TYPE,
						"selected" => $values['download_type'],
						"show" => $values['download_type_show'],
						"value" => array(
										"subtitle" => HOTN_ANIMELIST_DEFAULT_SUBTITLE,
										"anime" => HOTN_ANIMELIST_DEFAULT_ANIME,
										"manga" => HOTN_ANIMELIST_DEFAULT_MANGA
									)
					),
					array(
						"type" => "submit",
						"value" => HOTN_ANIMELIST_DEFAULT_FORM_ADD
					)
				)
	);
?>